home *** CD-ROM | disk | FTP | other *** search
- class MallCrawl extends MovieClip
- {
- var paused;
- var twinsArray;
- var upEscalators;
- var downEscalators;
- var randomTwinSpots;
- var randomPowerSpots;
- var randomBrokenSpots;
- var startPos;
- var Background;
- var level;
- var FOLLOWER_DISTANCE = 15;
- var MAX_LEVELS = 3;
- var twinNames = new Array("Cloe","Jade","Nita","Nora","Sasha","Yasmin");
- function MallCrawl()
- {
- super();
- this._name = "MallCrawl";
- _global[this._name] = this;
- this.paused = false;
- this.twinsArray = new Array();
- this.upEscalators = new Array();
- this.downEscalators = new Array();
- this.randomTwinSpots = new Array();
- this.randomPowerSpots = new Array();
- this.randomBrokenSpots = new Array();
- this.startPos = {x:this._x,y:this._y};
- }
- function gameOver()
- {
- _global.Footer.stopTimer();
- this.resetStage();
- this.gotoAndStop("game_over");
- }
- function generateTwins(amt)
- {
- var _loc3_ = new Array();
- var _loc5_ = 0;
- while(_loc5_ < this.twinNames.length)
- {
- _loc3_.push(this.twinNames[_loc5_]);
- _loc5_ = _loc5_ + 1;
- }
- _loc5_ = 0;
- while(_loc5_ < _loc3_.length)
- {
- if(_loc3_[_loc5_] == _global.char_selected)
- {
- _loc3_.popById(_loc5_);
- break;
- }
- _loc5_ = _loc5_ + 1;
- }
- var _loc7_ = new Array();
- _loc5_ = 0;
- while(_loc5_ < amt)
- {
- var _loc6_ = random(_loc3_.length - 1);
- var _loc4_ = _loc3_.popById(_loc6_);
- _loc7_.push(_loc4_);
- this.Background.attachMovie(_loc4_ + "Twin",_loc4_ + "Twin",this.Background.getNextHighestDepth());
- _loc5_ = _loc5_ + 1;
- }
- this.Background.attachMovie("PuppyTwin","PuppyTwin",this.Background.getNextHighestDepth());
- return _loc7_;
- }
- function generatePowerItems()
- {
- var _loc3_ = new Array();
- var _loc2_ = 0;
- while(_loc2_ < this.randomPowerSpots.length)
- {
- _loc3_.push(this.randomPowerSpots[_loc2_]);
- _loc2_ = _loc2_ + 1;
- }
- var _loc5_ = random(3);
- var _loc4_ = _loc3_.popById(random(_loc3_.length - 1));
- switch(_loc5_)
- {
- case 0:
- this.Background.attachMovie("SkateBoard","SkateBoard",this.Background.getNextHighestDepth(),{_x:_loc4_._x,_y:_loc4_._y});
- break;
- case 1:
- this.Background.attachMovie("Trike","Trike",this.Background.getNextHighestDepth(),{_x:_loc4_._x,_y:_loc4_._y});
- break;
- case 2:
- this.Background.attachMovie("Wheeler","Wheeler",this.Background.getNextHighestDepth(),{_x:_loc4_._x,_y:_loc4_._y});
- }
- _loc4_ = _loc3_.popById(random(_loc3_.length - 1));
- this.Background.attachMovie("Bottle","Bottle",this.Background.getNextHighestDepth(),{_x:_loc4_._x,_y:_loc4_._y});
- _loc4_ = _loc3_.popById(random(_loc3_.length - 1));
- this.Background.attachMovie("Guitar","Guitar",this.Background.getNextHighestDepth(),{_x:_loc4_._x,_y:_loc4_._y});
- }
- function generateBrokenItems(amt)
- {
- var _loc6_ = new Array("BrokenCar","BrokenMirror","BrokenBrush");
- var _loc5_ = new Array();
- var _loc4_ = 0;
- while(_loc4_ < this.randomBrokenSpots.length)
- {
- _loc5_.push(this.randomBrokenSpots[_loc4_]);
- _loc4_ = _loc4_ + 1;
- }
- var _loc10_ = random(3);
- _loc4_ = 0;
- while(_loc4_ < amt)
- {
- var _loc2_ = _loc5_.popById(random(_loc5_.length - 1));
- var _loc3_ = _loc6_.popById(random(_loc6_.length - 1));
- this.Background.attachMovie(_loc3_,_loc3_,this.Background.getNextHighestDepth(),{_x:_loc2_._x,_y:_loc2_._y});
- _loc4_ = _loc4_ + 1;
- }
- }
- function nextLevel()
- {
- this.level += 1;
- _global.Footer.setLevel();
- _global.Footer.addScore(500 + _global.Footer.time / 1000);
- _global.Footer.setTimer(180);
- _global.Footer.startTimer();
- this.twinsArray = new Array();
- this.upEscalators = new Array();
- this.downEscalators = new Array();
- this.randomTwinSpots = new Array();
- this.randomPowerSpots = new Array();
- this.randomBrokenSpots = new Array();
- this.gotoAndPlay("level" + this.level);
- }
- function outOfTime()
- {
- _global.Footer.stopTimer();
- this.resetStage();
- this.gotoAndStop("no_time");
- }
- function pause()
- {
- if(!this.paused)
- {
- this.paused = true;
- }
- else
- {
- this.paused = false;
- }
- }
- function popUp(twin_Names)
- {
- this.pause();
- this.attachMovie("PopUp","PopUp",1,{twin_Names:twin_Names});
- }
- function resetStage()
- {
- this._x = this.startPos.x;
- this._y = this.startPos.y;
- }
- function lostLevel()
- {
- this.resetStage();
- if(this.level > 1)
- {
- this.level -= 1;
- }
- else
- {
- this.level = 0;
- }
- _global.Footer.stopTimer();
- _global.Footer.setTimer(180);
- _global.Footer.setScore(0);
- _global.Footer.setLives(3);
- this.twinsArray = new Array();
- this.upEscalators = new Array();
- this.downEscalators = new Array();
- this.randomTwinSpots = new Array();
- this.randomPowerSpots = new Array();
- this.randomBrokenSpots = new Array();
- this.nextLevel();
- }
- function winLevel()
- {
- _global.Rescuer.resetPowerItems();
- _global.Footer.stopTimer();
- this.resetStage();
- trace(this.level + " < " + this.MAX_LEVELS);
- if(this.level < this.MAX_LEVELS)
- {
- this.gotoAndStop("next_level");
- }
- else
- {
- this.gotoAndStop("win");
- }
- }
- }
-